#include "main.h"

/*Global variable*/
uint32_t Tick=0;
extern uint8_t Frame[SIZE_FRAME];
extern uint8_t Count_Frame;
extern __IO uint8_t Boolen;

void SysTick_Handler(void){
	Tick++;
}
void PORTC_PORTD_IRQHandler(void){

}
void UART0_IRQHandler(void)
{
	uint8_t Char;
	static uint8_t Index=0;								/*Index of data*/
	if((UART0->S1 & (0x01 << 5)))					/*flag receive data*/
		{
		Char=UART0_GetChar();

		if(((Index==0)&&(Char=='S'))||(Index>0))
			{			
				Frame[Index] = Char;
				if(Index>=(SIZE_FRAME-1))						/*check end frame*/
				{	
					Boolen=1;													/*receive enough data 1 frame*/		
					Index=0;
					Count_Frame++;										/*Increase Frame*/
				}else
				{					
					Index++;
				}	
			}
		}
}
void PIT_IRQHandler(void){
	Toggle_Red();
	PIT_ClearFlag(TIMER0);
}
